<template>
	<view class="tab1-box full box relative">
		<view class="change-title">
			<text>如何更换滤芯</text>
		</view>
		<view class="change-viedo">
      <video :src="videoUrl" class="full box relative" />
		</view>
		<view class="video-text">
			<text>可参照视频自行更换滤芯，也可联系水管家上门更换 (需收取上门服务费)</text>
		</view>
		<view class="table-box">
			<view class="table-header">
				<view class="header-item">
					<text>服务名称</text>
				</view>
				<view class="header-item">
					<text>服务费</text>
				</view>
				<view class="header-item">
					<text>操作</text>
				</view>
			</view>
			<view class="table-content">
				<view class="content-item">
					<text class="content-text">上门滤芯更换服务</text>
				</view>
				<view class="content-item">
					<text class="content-text">50 元</text>
				</view>
				<view class="content-item active">
					<view class="send-btn" @click="handleShenQing">
						<text>申请上门更换</text>
					</view>
				</view>
			</view>
		</view>
		<view class="red-text-tip">
			<text>注意: 请在收到滤芯之后再提交申请上门更换滤芯服务！</text>
		</view>
		<view class="change-title">
			<text>滤芯免费</text>
		</view>
		<view class="free-text">
			<text>正常使用智小满智能设备(非欠费状态)，滤芯低于5%时，平台会免费寄送新的滤芯。收货后请及时更换滤芯，点击以下按钮进行复位。</text>
		</view>
		<view class="small-tip-tex">
			<text>注意: 为保障饮水健康以及下次还能准时收到新虑芯，请务必在系统中进行复位操作</text>
		</view>
		<view class="footer-btn">
			<u-button type="primary" shape="circle" @click="handleReset">滤芯复位</u-button>
		</view>
	</view>
</template>

<script>
	import { request, showLoading, toast } from '@/utils/tool';

	export default {
		data() {
			return {
        videoUrl: "",
			}
		},
    created() {
      this.initData()
    },
		emits: ["apply"],
		methods: {
      async initData(){
        const hide = showLoading("正在获取")
        const resp = await  request({
          url:"/lvxin/getvideo",
          method: "GET",
        }).finally(hide)
        const data = resp.data || {}
        this.videoUrl = data.video || ""
        console.log(resp,'resp')
      },
			handleShenQing() {
				console.log('盛情');
				this.$emit("apply")
			},
			handleReset() {
				this.$emit("reset")
			},
		},
	}
</script>

<style lang="scss" scoped>
	.tab1-box {
		padding: 28rpx 30rpx 0;
		box-sizing: border-box;
		position: relative;

		.footer-btn {
			margin-top: 64rpx;
		}

		.small-tip-tex {
			font-size: 22rpx;
			color: #333333;
			line-height: 32rpx;
			margin-top: 20rpx;
		}

		.free-text {
			margin-top: 18rpx;
			font-size: 28rpx;
			color: #333333;
			line-height: 40rpx;
			white-space: pre-wrap;
			word-break: break-all;
		}

		.red-text-tip {
			font-size: 22rpx;
			color: #FF0000;
			line-height: 44rpx;
			margin-top: 16rpx;
			margin-bottom: 52rpx;
			white-space: pre-wrap;
			word-break: break-all;
		}

		.table-box {
			margin-top: 36rpx;

			.table-content {
				margin-top: 2rpx;
				display: flex;
				align-items: center;

				.content-item {
					flex: 1;
					height: 86rpx;
					border-radius: 4rpx 4rpx 4rpx 4rpx;
					margin-right: 2rpx;
					text-align: center;
					background: #D3E1FC;

					&.active {
						display: flex;
						align-items: center;
						justify-content: center;

						.send-btn {
							width: 181rpx;
							height: 48rpx;
							background: #39B54A;
							border-radius: 24rpx 24rpx 24rpx 24rpx;
							font-size: 22rpx;
							color: #FFFFFF;
							line-height: 48rpx;
							text-align: center;
						}
					}

					&:last-child {
						margin-right: 0;
					}

					.content-text {
						font-size: 22rpx;
						color: #2A3E68;
						line-height: 86rpx;
					}
				}
			}

			.table-header {
				display: flex;
				align-items: center;

				.header-item {
					height: 64rpx;
					flex: 1;
					background: #3361F0;
					border-radius: 4rpx 4rpx 4rpx 4rpx;
					font-size: 28rpx;
					color: #FFFFFF;
					line-height: 64rpx;
					text-align: center;
					margin-right: 2rpx;

					&:last-child {
						margin-right: 0;
					}
				}

			}
		}

		.video-text {
			font-size: 22rpx;
			color: #000000;
			line-height: 40rpx;
			margin-top: 16rpx;
		}

		.change-title {
			font-weight: bold;
			font-size: 36rpx;
			color: #3361F0;
			line-height: 50rpx;
			text-align: center;
		}

		.change-viedo {
			width: 100%;
			height: 398rpx;
			border-radius: 16rpx 16rpx 16rpx 16rpx;
			margin-top: 20rpx;
			overflow: hidden;
		}
	}
</style>